//
//  DDEmojiVeiw.swift
//  swift微博
//
//  Created by whitcast on 16/7/21.
//  Copyright © 2016年 whitcast. All rights reserved.
//

import UIKit
//用于添加toolbar和DDEmojiCollectionView
class DDEmojiVeiw: UIView {
    //
    //toolbar
    lazy var toolbar = DDEmojiToolBar.init(frame: CGRectZero)
    //Collectionview
    lazy var emojiView: DDEmojiCollectionView = {
    
        let flowLayout = UICollectionViewFlowLayout()
        
        let view = DDEmojiCollectionView(frame: CGRectZero, collectionViewLayout: flowLayout)
        
                return view
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        //设置ui
        setupUI()
        

    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
   //设置UI
    private func setupUI(){
        //添加
            addSubview(emojiView)
        addSubview(toolbar)
    
        //约束
        emojiView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self)
            make.leading.equalTo(self)
            make.trailing.equalTo(self)
            make.bottom.equalTo(toolbar.snp_top)
        }
        
        toolbar.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(self)
            make.trailing.equalTo(self)
            make.bottom.equalTo(self)
            make.height.equalTo(30)
        }
        
        
    }
}
